package com.example.springboot_demo.controller;

import com.example.springboot_demo.pojo.User;
import com.example.springboot_demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @BelongsProject: springboot_demo
 * @BelongsPackage: com.example.springboot_demo.controller
 * @Author: 江岸
 * @CreateTime: 2020-07-28 14:02
 * @Description:
 */
@RestController
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("query")
    public List<User> query(){
        List<User> query = userService.query();
        return query;
    }

    @RequestMapping("add")
    public int add(@RequestBody  User user){
        return userService.add(user);
    }
}
